package br.pucrs.prototipoonline.logger;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.PropertyConfigurator;


/**
 * 
 * @author Ricardo Luckei
 * @author Gelson Gentil
 *
 */
public class Log4jInit extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public void init() {
		String prefix = getServletContext().getRealPath("/");
		String file = getInitParameter("log4j-init-file");
		//carrega o arquivo de configuracao informado no web.xml
		if (file != null) {
			System.out.println("Configurando Log4j");
			PropertyConfigurator.configure(prefix + file);
		}
	}

	public void doGet(HttpServletRequest req, HttpServletResponse res) {
	}
}
